import { create } from "zustand"
import myMiddlewares from "./my-middlewares"

type UseStoreState = {
  bears: number
}

type UseStoreActions = {
  increase: (by: number) => void
}

type UseStore = UseStoreState & UseStoreActions

const useStore = create<UseStore>()(
  myMiddlewares((set) => ({
    bears: 0,
    increase: (by) =>
      set((state) => {
        state.bears = state.bears + by
      })
  }))
)

export default useStore
